#ifndef HTF_JPEG_DECODER_H
#define HTF_JPEG_DECODER_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stddef.h>   // for size_t
#include <stdint.h>   // for uint8_t

/**
 * @brief Decode JPEG data in memory to RGB format (3 bytes per pixel)
 *
 * @param jpeg_data  Pointer to the input JPEG data (non-NULL)
 * @param size       Number of bytes in the JPEG data (must be > 0)
 * @param out_rgb    Pointer to the output RGB data (caller must free it using free())
 * @param width      Output image width (in pixels)
 * @param height     Output image height (in pixels)
 * @return int       0 indicates success; a negative number indicates an error (-1: parameter error, -2: decoding exception, -3: insufficient memory).
 */
int htf_jpeg_decode_to_rgb(const uint8_t* jpeg_data, size_t size,
                           uint8_t** out_rgb, int* width, int* height);

#ifdef __cplusplus
}
#endif

#endif // HTF_JPEG_DECODER_H